dynamic class Taxi extends MovieClip
{
    var grav: Number = 1.2;
    var hitSomeone: Boolean = false;
    var _name;
    var _parent;
    var _rotation;
    var _x;
    var _xscale;
    var _y;
    var hitGround;
    var num;
    var xv;
    var yv;

    function Taxi()
    {
        super();
        this.hitGround = false;
    }

    function init()
    {
        this.num = Number(this._name.substr(4, this._name.length - 4));
        trace("num:" + this.num);
        this.xv = this.yv = 0;
        if (this._x < 285) 
        {
            this._xscale = -100;
        }
    }

    function EF()
    {
        this._x = this._x + this.xv;
        this._y = this._y + this.yv;
        this.yv = this.yv + this.grav;
        if (this._parent._parent.ground.hitTest(this._x, this._y, true)) 
        {
            if (!this.hitGround) 
            {
                this.hitGround = true;
                SoundManager.startSound("taxiEngine");
            }
            var __reg5 = this._parent._parent.findPathPoint(this._x);
            this._y = this._parent._parent.pointsA[__reg5].y;
            this._rotation = this.getGroundA(__reg5);
            if (this._x > 288) 
            {
                if (this.xv < 4) 
                {
                    this.xv = 3.5;
                }
            }
            else if (this.xv > -4) 
            {
                this.xv = -3.5;
            }
            this.yv = -2;
        }
        if (this._x < -10 || this._x > 610 || this._y > 460) 
        {
            this._parent._parent.removeObject(this);
        }
        var __reg2 = this._parent._parent.checkEnemyHit(this);
        if (__reg2.length > 0) 
        {
            var __reg3 = this.xv;
            if (!this.hitSomeone) 
            {
                this.hitSomeone = true;
                SoundManager.startSound("taxihorn");
                SoundManager.startSound("getoutthebleedingway");
            }
            for (var __reg4 in __reg2) 
            {
                __reg2[__reg4].knockDown(__reg3);
            }
        }
    }

    function getGroundA(p)
    {
        if (p == 0) 
        {
            ++p;
        }
        if (p == this._parent._parent.pointsA.length - 1) 
        {
            --p;
        }
        var __reg3 = MyMath.getAngle(this._parent._parent.pointsA[p - 1].x, this._parent._parent.pointsA[p - 1].y, this._parent._parent.pointsA[p + 1].x, this._parent._parent.pointsA[p + 1].y);
        return __reg3;
    }

}
